/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.jclip.examples.helloworld;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.BufferedWriter;
import java.io.FileWriter;
import java.util.HashMap;

import javax.swing.JMenu;
import javax.swing.JMenuItem;

import org.jclip.runtime.JavaClientPage;
import java.awt.Rectangle;
import javax.swing.GroupLayout.Alignment;
import javax.swing.GroupLayout;
import javax.swing.LayoutStyle.ComponentPlacement;
import javax.swing.JPanel;
import javax.swing.JLabel;
import java.awt.Color;
import java.awt.Font;
import javax.swing.SwingConstants;

/**
 *
 * @author kissmyirish
 */
public class DoodlePanel2 extends JavaClientPage {
	private HashMap<String, Object> hm = new HashMap<String, Object>();
	private JMenu menu = new JMenu("Panel");
	private String pageTitle = "MyDoodle.com";
    /**
     * Creates new form DoodlePanel2
     */
    public DoodlePanel2(HashMap<String,Object> hm) {
    	super(hm);
    	this.hm=hm;
       	setBackground(new Color(255, 255, 255));
    	setBounds(new Rectangle(100, 100, 800, 600));
        initComponents();
        JMenuItem mnIT = new JMenuItem("Panel2");
        menu.add(mnIT);
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jScrollPane1 = new javax.swing.JScrollPane();
        jPanel1 = new javax.swing.JPanel();
        upperPanel = new javax.swing.JPanel();
        doodle = new javax.swing.JLabel();
        signIN = new javax.swing.JLabel();
        lowerPanel = new javax.swing.JPanel();
        easyScheduling = new javax.swing.JLabel();
        freeOfCharge = new javax.swing.JLabel();
        jButton1 = new javax.swing.JButton();
        create = new javax.swing.JLabel();
        envelope = new javax.swing.JLabel();
        poll = new javax.swing.JLabel();
        lunch2 = new javax.swing.JLabel();
        participants = new javax.swing.JLabel();
        viewExample = new javax.swing.JLabel();
        dateAndTime = new javax.swing.JLabel();
        lunch1 = new javax.swing.JLabel();
        confirm = new javax.swing.JLabel();
        invite = new javax.swing.JLabel();
        jLabel1 = new javax.swing.JLabel();
        jPanel2 = new javax.swing.JPanel();
        jPanel3 = new javax.swing.JPanel();
        adsFree = new javax.swing.JLabel();
        premiumDoodle = new javax.swing.JLabel();
        orderNow = new javax.swing.JLabel();

        jPanel1.setLayout(new java.awt.BorderLayout());

        upperPanel.setBackground(new java.awt.Color(255, 255, 255));

        doodle.setFont(new java.awt.Font("Arial Black", 1, 36)); // NOI18N
        doodle.setForeground(new java.awt.Color(51, 102, 255));
        doodle.setText("MyDoodle");

        signIN.setBackground(new java.awt.Color(255, 255, 255));
        signIN.setForeground(new java.awt.Color(0, 102, 204));
        signIN.setText("Sign in");

        javax.swing.GroupLayout upperPanelLayout = new javax.swing.GroupLayout(upperPanel);
        upperPanelLayout.setHorizontalGroup(
        	upperPanelLayout.createParallelGroup(Alignment.LEADING)
        		.addGroup(Alignment.TRAILING, upperPanelLayout.createSequentialGroup()
        			.addGap(20)
        			.addComponent(doodle)
        			.addPreferredGap(ComponentPlacement.RELATED, 593, Short.MAX_VALUE)
        			.addComponent(signIN)
        			.addGap(55))
        );
        upperPanelLayout.setVerticalGroup(
        	upperPanelLayout.createParallelGroup(Alignment.LEADING)
        		.addGroup(upperPanelLayout.createSequentialGroup()
        			.addGap(24)
        			.addGroup(upperPanelLayout.createParallelGroup(Alignment.LEADING)
        				.addComponent(doodle, GroupLayout.PREFERRED_SIZE, 40, GroupLayout.PREFERRED_SIZE)
        				.addComponent(signIN))
        			.addContainerGap(36, Short.MAX_VALUE))
        );
        upperPanel.setLayout(upperPanelLayout);

        jPanel1.add(upperPanel, java.awt.BorderLayout.PAGE_START);

        lowerPanel.setBackground(new java.awt.Color(215, 234, 253));
        lowerPanel.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(255, 255, 255), 5));

        easyScheduling.setFont(new java.awt.Font("Tahoma", 0, 24)); // NOI18N
        easyScheduling.setForeground(new java.awt.Color(0, 102, 204));
        easyScheduling.setText("Easy scheduling");

        freeOfCharge.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        freeOfCharge.setForeground(new java.awt.Color(102, 102, 102));
        freeOfCharge.setText("Free of charge and without registration");

        jButton1.setBackground(new java.awt.Color(0, 0, 204));
        jButton1.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        jButton1.setForeground(new java.awt.Color(255, 255, 255));
        jButton1.setText("Schedule an event");
        jButton1.addActionListener(new ActionListener() {
        	public void actionPerformed(ActionEvent e)
        	{  
        	try{
        		browser.go("http://localhost//org.jclip.examples.helloworld//bin//#org.jclip.examples.helloworld.DoodleScheduleEvent", hm);
        		} catch (Exception ex){
        			ex.printStackTrace();
        		}
        		
        		
        	}
        });

        create.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        create.setText("Create");

        poll.setForeground(new java.awt.Color(102, 102, 102));
        poll.setText("poll");
        poll.setToolTipText("");
        poll.setVerticalAlignment(javax.swing.SwingConstants.TOP);

        lunch2.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        lunch2.setIcon(new javax.swing.ImageIcon(getClass().getResource("Calendar Check.png"))); // NOI18N
        lunch2.setText("Lunch!");

        participants.setForeground(new java.awt.Color(102, 102, 102));
        participants.setText("participants");
        participants.setToolTipText("");
        participants.setVerticalAlignment(javax.swing.SwingConstants.TOP);

        viewExample.setBackground(new java.awt.Color(255, 255, 255));
        viewExample.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        viewExample.setForeground(new java.awt.Color(0, 102, 204));
        viewExample.setText("View example");

        dateAndTime.setForeground(new java.awt.Color(102, 102, 102));
        dateAndTime.setText("date and time");
        dateAndTime.setToolTipText("");
        dateAndTime.setVerticalAlignment(javax.swing.SwingConstants.TOP);

        lunch1.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        lunch1.setForeground(new java.awt.Color(102, 102, 102));
        lunch1.setIcon(new javax.swing.ImageIcon(getClass().getResource("calendar.png"))); // NOI18N
        lunch1.setText("Lunch?");

        confirm.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        confirm.setText("Confirm");

        invite.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        invite.setText("Invite");

        jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("envelope.png"))); // NOI18N

        jPanel2.setBackground(new java.awt.Color(255, 255, 255));

        adsFree.setFont(new java.awt.Font("Tahoma", 0, 24)); // NOI18N
        adsFree.setText("Decorate your ads-free Doodle");

        premiumDoodle.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        premiumDoodle.setText("Premium Doodle gives you an ads-free subscription with decoration options.");
        premiumDoodle.setVerticalAlignment(javax.swing.SwingConstants.TOP);

        orderNow.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        orderNow.setForeground(new java.awt.Color(0, 102, 204));
        orderNow.setText("Order Premium Doodle NOW");
        
        JPanel doodleCrown = new JPanel();
        doodleCrown.setBackground(new Color(255, 255, 255));
        doodleCrown.setLayout(null);
        
        JLabel d_1 = new JLabel("d");
        d_1.setBounds(42, -14, 80, 171);
        d_1.setVerticalTextPosition(SwingConstants.TOP);
        d_1.setVerticalAlignment(SwingConstants.TOP);
        d_1.setFont(new Font("Arial Black", Font.PLAIN, 120));
        d_1.setForeground(new Color(0, 102, 255));
        doodleCrown.add(d_1);

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3Layout.setHorizontalGroup(
        	jPanel3Layout.createParallelGroup(Alignment.LEADING)
        		.addGroup(jPanel3Layout.createSequentialGroup()
        			.addContainerGap()
        			.addComponent(doodleCrown, GroupLayout.PREFERRED_SIZE, 132, GroupLayout.PREFERRED_SIZE)
        			.addGap(18)
        			.addGroup(jPanel3Layout.createParallelGroup(Alignment.LEADING)
        				.addComponent(orderNow)
        				.addComponent(premiumDoodle)
        				.addComponent(adsFree))
        			.addContainerGap(273, Short.MAX_VALUE))
        );
        jPanel3Layout.setVerticalGroup(
        	jPanel3Layout.createParallelGroup(Alignment.LEADING)
        		.addGroup(jPanel3Layout.createSequentialGroup()
        			.addContainerGap()
        			.addGroup(jPanel3Layout.createParallelGroup(Alignment.LEADING)
        				.addComponent(doodleCrown, GroupLayout.PREFERRED_SIZE, 131, Short.MAX_VALUE)
        				.addGroup(jPanel3Layout.createSequentialGroup()
        					.addComponent(adsFree)
        					.addPreferredGap(ComponentPlacement.RELATED)
        					.addComponent(premiumDoodle, GroupLayout.PREFERRED_SIZE, 41, GroupLayout.PREFERRED_SIZE)
        					.addPreferredGap(ComponentPlacement.RELATED)
        					.addComponent(orderNow)))
        			.addContainerGap())
        );
        jPanel3.setLayout(jPanel3Layout);

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2Layout.setHorizontalGroup(
        	jPanel2Layout.createParallelGroup(Alignment.LEADING)
        		.addComponent(jPanel3, GroupLayout.DEFAULT_SIZE, 897, Short.MAX_VALUE)
        );
        jPanel2Layout.setVerticalGroup(
        	jPanel2Layout.createParallelGroup(Alignment.LEADING)
        		.addGroup(jPanel2Layout.createSequentialGroup()
        			.addContainerGap()
        			.addComponent(jPanel3, GroupLayout.PREFERRED_SIZE, 153, Short.MAX_VALUE)
        			.addContainerGap())
        );
        jPanel2.setLayout(jPanel2Layout);

        javax.swing.GroupLayout lowerPanelLayout = new javax.swing.GroupLayout(lowerPanel);
        lowerPanelLayout.setHorizontalGroup(
        	lowerPanelLayout.createParallelGroup(Alignment.LEADING)
        		.addGroup(lowerPanelLayout.createSequentialGroup()
        			.addContainerGap()
        			.addGroup(lowerPanelLayout.createParallelGroup(Alignment.LEADING)
        				.addComponent(easyScheduling)
        				.addComponent(freeOfCharge)
        				.addComponent(jButton1)
        				.addComponent(viewExample, GroupLayout.PREFERRED_SIZE, 111, GroupLayout.PREFERRED_SIZE)
        				.addGroup(lowerPanelLayout.createSequentialGroup()
        					.addGap(36)
        					.addGroup(lowerPanelLayout.createParallelGroup(Alignment.LEADING)
        						.addComponent(lunch1)
        						.addGroup(lowerPanelLayout.createSequentialGroup()
        							.addGap(10)
        							.addGroup(lowerPanelLayout.createParallelGroup(Alignment.TRAILING)
        								.addComponent(poll, GroupLayout.PREFERRED_SIZE, 48, GroupLayout.PREFERRED_SIZE)
        								.addComponent(create))))
        					.addGap(110)
        					.addGroup(lowerPanelLayout.createParallelGroup(Alignment.LEADING)
        						.addGroup(lowerPanelLayout.createSequentialGroup()
        							.addGroup(lowerPanelLayout.createParallelGroup(Alignment.LEADING)
        								.addGroup(lowerPanelLayout.createSequentialGroup()
        									.addGap(17)
        									.addComponent(participants, GroupLayout.PREFERRED_SIZE, 70, GroupLayout.PREFERRED_SIZE))
        								.addComponent(invite))
        							.addGap(128)
        							.addGroup(lowerPanelLayout.createParallelGroup(Alignment.LEADING)
        								.addComponent(lunch2)
        								.addGroup(lowerPanelLayout.createSequentialGroup()
        									.addGap(3)
        									.addGroup(lowerPanelLayout.createParallelGroup(Alignment.TRAILING)
        										.addComponent(confirm)
        										.addComponent(dateAndTime, GroupLayout.PREFERRED_SIZE, 70, GroupLayout.PREFERRED_SIZE)))))
        						.addGroup(lowerPanelLayout.createSequentialGroup()
        							.addComponent(jLabel1)
        							.addGap(75)
        							.addComponent(envelope)))))
        			.addContainerGap(336, Short.MAX_VALUE))
        		.addComponent(jPanel2, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        lowerPanelLayout.setVerticalGroup(
        	lowerPanelLayout.createParallelGroup(Alignment.LEADING)
        		.addGroup(lowerPanelLayout.createSequentialGroup()
        			.addGap(28)
        			.addGroup(lowerPanelLayout.createParallelGroup(Alignment.TRAILING)
        				.addGroup(lowerPanelLayout.createSequentialGroup()
        					.addComponent(easyScheduling)
        					.addPreferredGap(ComponentPlacement.RELATED)
        					.addComponent(freeOfCharge)
        					.addGap(18)
        					.addComponent(jButton1, GroupLayout.PREFERRED_SIZE, 36, GroupLayout.PREFERRED_SIZE)
        					.addGap(18)
        					.addGroup(lowerPanelLayout.createParallelGroup(Alignment.LEADING)
        						.addGroup(lowerPanelLayout.createSequentialGroup()
        							.addGap(30)
        							.addGroup(lowerPanelLayout.createParallelGroup(Alignment.TRAILING)
        								.addGroup(lowerPanelLayout.createSequentialGroup()
        									.addComponent(envelope)
        									.addGap(54))
        								.addGroup(lowerPanelLayout.createSequentialGroup()
        									.addGroup(lowerPanelLayout.createParallelGroup(Alignment.TRAILING)
        										.addComponent(jLabel1)
        										.addComponent(lunch2))
        									.addGap(18)))
        							.addGroup(lowerPanelLayout.createParallelGroup(Alignment.LEADING)
        								.addComponent(confirm)
        								.addGroup(lowerPanelLayout.createSequentialGroup()
        									.addGap(3)
        									.addComponent(invite))))
        						.addGroup(lowerPanelLayout.createSequentialGroup()
        							.addComponent(viewExample)
        							.addGap(18)
        							.addComponent(lunch1)
        							.addGap(18)
        							.addComponent(create)))
        					.addPreferredGap(ComponentPlacement.RELATED)
        					.addGroup(lowerPanelLayout.createParallelGroup(Alignment.LEADING)
        						.addComponent(poll, GroupLayout.PREFERRED_SIZE, 35, GroupLayout.PREFERRED_SIZE)
        						.addComponent(dateAndTime, GroupLayout.PREFERRED_SIZE, 35, GroupLayout.PREFERRED_SIZE))
        					.addGap(51))
        				.addGroup(lowerPanelLayout.createSequentialGroup()
        					.addComponent(participants, GroupLayout.PREFERRED_SIZE, 35, GroupLayout.PREFERRED_SIZE)
        					.addGap(53)))
        			.addPreferredGap(ComponentPlacement.RELATED)
        			.addComponent(jPanel2, GroupLayout.PREFERRED_SIZE, 175, GroupLayout.PREFERRED_SIZE)
        			.addContainerGap(140, Short.MAX_VALUE))
        );
        lowerPanel.setLayout(lowerPanelLayout);

        jPanel1.add(lowerPanel, java.awt.BorderLayout.CENTER);

        jScrollPane1.setViewportView(jPanel1);
        jScrollPane1.getVerticalScrollBar().setUnitIncrement(16);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(20, 20, 20)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 661, Short.MAX_VALUE)
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 616, Short.MAX_VALUE)
                .addContainerGap())
        );
    }// </editor-fold>//GEN-END:initComponents
    
    public JMenu getMenus()
    {
    	return menu;
    }
    
    public String getTitle()
    {
    	return pageTitle;
    }
    
    private void writeFile()
    {
    	try{
    		  // Create file 
    		  FileWriter fstream = new FileWriter("D://out.txt");
    		  BufferedWriter out = new BufferedWriter(fstream);
    		  out.write("Hello Java");
    		  //Close the output stream
    		  out.close();
    		  }catch (Exception e){//Catch exception if any
    		  System.err.println("Error: " + e.getMessage());
    		  }
    }
    
    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel adsFree;
    private javax.swing.JLabel confirm;
    private javax.swing.JLabel create;
    private javax.swing.JLabel dateAndTime;
    private javax.swing.JLabel doodle;
    private javax.swing.JLabel easyScheduling;
    private javax.swing.JLabel envelope;
    private javax.swing.JLabel freeOfCharge;
    private javax.swing.JLabel invite;
    private javax.swing.JLabel d;
    private javax.swing.JButton jButton1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JPanel lowerPanel;
    private javax.swing.JLabel lunch1;
    private javax.swing.JLabel lunch2;
    private javax.swing.JLabel orderNow;
    private javax.swing.JLabel participants;
    private javax.swing.JLabel poll;
    private javax.swing.JLabel premiumDoodle;
    private javax.swing.JLabel signIN;
    private javax.swing.JPanel upperPanel;
    private javax.swing.JLabel viewExample;
}
